-- 上机练习一
BEGIN;
INSERT INTO student(id,student_name,age,gender,birthday,classID,begin_year)
VALUES(3005,'十一',20,'女','2023-09-18',3,2023);
UPDATE student SET student_name='季',age='20' WHERE id=1005;
DELETE FROM student WHERE age<18;
COMMIT;
ROLLBACK;

-- 上机练习二
CREATE DATABASE test CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
USE test;
CREATE TABLE accout(
id INT AUTO_INCREMENT PRIMARY KEY,
accout_name VARCHAR(20) NOT NULL ,
phone VARCHAR(11) NOT NULL,
balance DECIMAL(30,5)
)
INSERT INTO accout VALUES ('10010101','张三','13541522563',100)
INSERT INTO accout VALUES ('10010102','李四','13012123443',100)
BEGIN;
UPDATE accout SET balance=balance-50 WHERE accout_name = '张三';
UPDATE accout SET balance=balance+50 WHERE accout_name = '李四';
COMMIT;
ROLLBACK;

-- 上机练习三
CREATE TABLE stuednt(
id INT AUTO_INCREMENT PRIMARY KEY,
student_name VARCHAR(20) NOT NULL ,
phone VARCHAR(11) NOT NULL,
gender ENUM('男','女'),INDEX(student_name)
)
SHOW CREATE TABLE stuednt
-- ALTER TABLE stuednt ADD INDEX st(student_name) 

-- 上机练习四
USE school_db100;
CREATE VIEW view_student_san
AS SELECT id,student_name FROM student WHERE student_name='张耀仁'